<template>
  <div>
    <div class="container">
      <div>
        <el-form v-loading="loading" :model="formInline" ref="formInline" class="select-submit-form" element-loading-text="Loading">
          <el-row type="flex">
            <el-col :span="8">
              <el-form-item label="大病赔案号" prop="caseNo"
                            :rules="[{ required: true, message: '请输入大病赔案号', trigger: 'blur' }]">
                <el-input v-model="formInline.caseNo" placeholder="请输入大病赔案号"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-button type="primary" @click="save('formInline')">申请重开</el-button>
            </el-col>
          </el-row>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
  import * as api from '@/api/baseDate'

  export default {
    name: 'rengonghepei',
    data() {
      return {
        loading: false,
        query: {
          address: '',
          name: '',
          pageIndex: 1,
          pageSize: 10
        },
        tableData: [],
        multipleSelection: [],
        delList: [],
        editVisible: false,
        pageTotal: 3,
        form: {},
        idx: -1,
        id: -1,
        formInline: {
          user: '',
          region: ''
        },
        caseReopenDemo: {},
      };
    },
    created() {

    },
    methods: {
      save(formName) {

        this.$refs[formName].validate((valid) => {
          if (valid) {
            var data = {
              "caseNo": this.formInline.caseNo,
              "comCode": Cookies.get("makeCom")
            }
            if (this.formInline.caseNo!=null && this.formInline.caseNo!= undefined && this.formInline.caseNo!= ''){
              this.loading = true;
            }
            api.getQueryByCaseNo(data).then(res => {
              this.loading = false;
              if (res.data.resultCode != "0000") {
                this.$message({
                  showClose: true,
                  message: res.data.resultMsg,
                  type: 'error'
                });
                return;
              } else {
                console.log(res)
                var caseReopenDemos = res.data;
                this.$router.push({
                  name: 'caseReopenDemo',
                  params: {
                    caseReopenDemo: JSON.stringify(caseReopenDemos),
                  }
                })
              }
            })
          } else {
            console.log('error submit!!');
            return false;
          }
        });

      },
    }
  };
</script>
<style lang="scss" scoped></style>
